
import {reqUserAddressList,reqTradeInfo} from '../../api'

const state={
    userAddressList:[], //收件信息列表
    tradeInfo:{},//订单交易页信息
}

const  mutations = {
     RECEIVE_USERADDRESSLISt(state,userAddressList){
        state.userAddressList= userAddressList
     },
     RECEIVE_TRADEINFO(state,tradeInfo){
        state.tradeInfo = tradeInfo
     }
}

const  actions ={
    //获取收获地址
     async  getUserAddressList({commit}){
          const  result = await reqUserAddressList()
          if(result.code === 200){
              commit('RECEIVE_USERADDRESSLISt',result.data)
          }
     },
     //订单交易页信息
     async getTradeInfo({commit}){
          const result = await  reqTradeInfo()
          if(result.code === 200){
               commit('RECEIVE_TRADEINFO',result.data)
          }
     }
}

const getters ={}

export  default {
     namespaced:true,
     state,
     mutations,
     actions,
     getters
}